<?xml version="1.0" encoding="UTF-8" ?>

<!--
    Document   : prepareDoc.xsl
    Created on : 24. September 2007, 13:45
    Author     : jtrapp
    Description:
        Purpose of transformation follows.
-->

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
    xmlns="http://earth.google.com/kml/2.2"  xmlns:kml="http://earth.google.com/kml/2.2"
>
    <xsl:output method="xml"/>
    <!-- TODO customize transformation rules 
         syntax recommendation http://www.w3.org/TR/xslt 
    -->
    <xsl:template match="/">
        <xsl:apply-templates select="*"/> 
    </xsl:template>
    
    <xsl:template match="kml:Placemark">
        <xsl:copy>
            <xsl:attribute name="id">yab<xsl:value-of select="count(preceding-sibling::*[name()='Placemark'])"/></xsl:attribute>
            <xsl:apply-templates select="@*|node()"/>                   
        </xsl:copy>
    </xsl:template>
  
    
    <xsl:template match="kml:description">
        <xsl:output cdata-section-elements="kml:description" />
        <xsl:copy-of select="." />
    </xsl:template>
    
    <xsl:template match="*|@*|node()">
        <xsl:copy>
            <xsl:apply-templates select="@*|node()"/>
        </xsl:copy>
    </xsl:template>
    
</xsl:stylesheet>
